home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / LANG / C / LIB / DESK / CORE / Desk / h_doc / Serial < prev    next >
Text File  |  1996-05-21  |  6KB  |  197 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Serial.h
  12.     Author:  Copyright © 1993 Jason Howat
  13.     Version: 1.10 (12 Dec 1993)
  14.     Purpose: Serial-SWI interfaces.
  15. */
  16.  
  17.  
  18. #ifndef __Desk_Serial_h
  19. #define __Desk_Serial_h
  20.  
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24.  
  25.  
  26. #ifndef __Desk_Core_h
  27.     #include "Desk.Core.h"
  28. #endif
  29.  
  30.  
  31. /* The Desk_serial_rate enumeration defines the values to be used when
  32.  * reading/setting baud rates with Desk_Serial_Get?xRate/Desk_Serial_Set?xRate.
  33.  */
  34. typedef enum
  35. {
  36.   Desk_serial_9600BAUD = 0,
  37.   Desk_serial_75BAUD,
  38.   Desk_serial_150BAUD,
  39.   Desk_serial_300BAUD,
  40.   Desk_serial_1200BAUD,
  41.   Desk_serial_2400BAUD,
  42.   Desk_serial_4800BAUD,
  43. /*Desk_serial_9600BAUD, */
  44.   Desk_serial_19200BAUD = 8,
  45.   Desk_serial_50BAUD,
  46.   Desk_serial_110BAUD,
  47.   Desk_serial_134_5BAUD,
  48.   Desk_serial_600BAUD,
  49.   Desk_serial_1800BAUD,
  50.   Desk_serial_3600BAUD,
  51.   Desk_serial_7200BAUD
  52. } Desk_serial_rate;
  53.  
  54.  
  55. /* The following #defines describe the meaning of the bits in the word used
  56.  * by Desk_Serial_GetStatust/Desk_Serial_SetStatus.
  57.  */
  58. #define Desk_serial_USEXONXOFF               0x00000001   
  59. #define Desk_serial_IGNOREDCDBIT             0x00000002
  60. #define Desk_serial_IGNOREDSRBIT             0x00000004
  61. #define Desk_serial_DTROFF                   0x00000008
  62. #define Desk_serial_IGNORECTSBIT             0x00000010
  63. #define Desk_serial_DONTUSERTSFLOWCONTROL    0x00000020
  64. #define Desk_serial_SUPPRESSINPUT            0x00000040
  65. #define Desk_serial_RTSHIGH                  0x00000080
  66. #define Desk_serial_XOFFRECEIVED             0x00010000
  67. #define Desk_serial_XOFFSENT                 0x00020000
  68. #define Desk_serial_DCDHIGH                  0x00040000
  69. #define Desk_serial_NOCARRIER                0x00040000
  70. #define Desk_serial_DSRHIGH                  0x00080000
  71. #define Desk_serial_RIHIGH                   0x00100000
  72. #define Desk_serial_CTSHIGH                  0x00200000
  73. #define Desk_serial_XOFFSENTMANUALLY         0x00400000
  74. #define Desk_serial_SPACEINRECEIVEBUFFER     0x00800000
  75.  
  76.  
  77. /* The following #defines describe the meaning of the bits in the word used
  78.  * by Desk_Serial_GetFormat/Desk_Serial_SetFormat.
  79.  */
  80. #define Desk_serial_8BITWORD         0x00000000
  81. #define Desk_serial_7BITWORD         0x00000001    
  82. #define Desk_serial_6BITWORD         0x00000002
  83. #define Desk_serial_5BITWORD         0x00000003
  84. #define Desk_serial_1STOPBIT         0x00000000
  85. #define Desk_serial_2STOPBITS        0x00000004
  86. #define Desk_serial_NOPARITY         0x00000000
  87. #define Desk_serial_PARITY           0x00000008
  88. #define Desk_serial_ODDPARITY        0x00000000
  89. #define Desk_serial_EVENPARITY       0x00000010
  90. #define Desk_serial_MARKPARITY       0x00000020
  91. #define Desk_serial_SPACEPARITY      0x00000030
  92.  
  93.  
  94. extern void    Desk_Serial_Activate(void);
  95. /*
  96.  * This function simply does an Desk_OS_Byte 2, 2 to enable the serial drivers.
  97.  */
  98.  
  99.  
  100. extern void    Desk_Serial_Deactivate(void);
  101. /*
  102.  * This function simply does an Desk_OS_Byte 2, 0 to disable the serial drivers.
  103.  */
  104.  
  105.  
  106. extern int Desk_Serial_GetStatus(void);
  107. /*
  108.  * This function returns the current status of the serial port as given by
  109.  * Desk_OS_SerialOp 0.
  110.  */
  111.  
  112.  
  113. extern void    Desk_Serial_SetStatus(int Desk_eor_mask, int Desk_and_mask);
  114. /*
  115.  * This function sets the current state of the serial port as given by
  116.  * Desk_OS_SerialOp 0.
  117.  */
  118.  
  119.  
  120. extern int Desk_Serial_GetFormat(void);
  121. /*
  122.  * This function returns the current format used for transmission/reception
  123.  * of characters on the serial line.
  124.  */
  125.  
  126.  
  127. extern void    Desk_Serial_SetFormat(int format);
  128. /*
  129.  * This function sets the format to use for transmission/reception of
  130.  * characters on the serial line.
  131.  */
  132.  
  133.  
  134. extern Desk_serial_rate Desk_Serial_GetTxRate(void);
  135. /*
  136.  * This function returns the current speed used for transmission
  137.  * of characters on the serial line.
  138.  */
  139.  
  140. extern Desk_serial_rate Desk_Serial_GetRxRate(void);
  141. /*
  142.  * This function returns the current speed used for reception
  143.  * of characters on the serial line.
  144.  */
  145.  
  146.  
  147. extern void    Desk_Serial_SetTxRate(Desk_serial_rate rate);
  148. /*
  149.  * This function sets the speed to use for transmission of
  150.  * characters on the serial line.
  151.  */
  152.  
  153. extern void    Desk_Serial_SetRxRate(Desk_serial_rate rate);
  154. /*
  155.  * This function sets the speed to use for reception of
  156.  * characters on the serial line.
  157.  */
  158.  
  159.  
  160. extern int Desk_Serial_GetByte(void);
  161. /*
  162.  * Reads a byte from the serial input buffer if one is available, otherwise
  163.  * returns -1.
  164.  */
  165.  
  166.  
  167. extern Desk_bool Desk_Serial_PutByte(int c);
  168. /*
  169.  * Inserts a byte to be transmitted into the serial output buffer if there
  170.  * is room.  Returns Desk_bool_TRUE if unable to send byte.
  171.  */
  172.  
  173.  
  174. extern void    Desk_Serial_SendBreak(int length);
  175. /*
  176.  * Transmits a break of the specified length.
  177.  */
  178.  
  179.  
  180. extern void Desk_Serial_NonZeroPollWordOnReceive(int Desk_pollword_value,
  181.                                             void *pollword);
  182. /*
  183.  * This function installs a piece of code on the InsV vector to monitor the
  184.  * insertion of characters into the serial input buffer.  It will modify the
  185.  * supplied pollword to the given value whenever an insertion occurs.  Also,
  186.  * an atexit function is registered to remove the vector claimant and the
  187.  * RMA based code.
  188.  */
  189.  
  190.   
  191. #ifdef __cplusplus
  192. }
  193. #endif
  194.  
  195.   
  196. #endif
  197.